package com.friend.street.action;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import com.friend.street.util.PathUtil;
/**文件下载的action*/
public class DownloadAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7118329525550475891L;
	/**文件目录*/
	private String dirPath;
	/**文件名称*/
	private String fileName;
	/**Mime类型*/
	private String contentType;
	
	public String execute(){
		
		return SUCCESS;
	}

	public InputStream getInputStream() throws Exception{
		String filePath = PathUtil.getWebInfPath() + "file" + File.separator +  dirPath + File.separator + fileName;
	    InputStream stream = new FileInputStream(new File(filePath));
	    return stream;
	}
	
	public void setDirPath(String dirPath) {
		this.dirPath = dirPath;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public String getFileName() {
		return fileName;
	}

	public String getContentType() {
		return contentType;
	}
	
	
	

}
